#ifndef __BSP_SOFT_I2C_H__
#define __BSP_SOFT_I2C_H__

#include <stdint.h>

typedef struct 
{
    uint8_t dev_addr;
    void (*delay)(void);
    void (*set_sda_mode_out)(uint8_t out_en);
    void (*set_scl)(uint8_t stat);
    void (*set_sda)(uint8_t stat);
    uint8_t (*get_sda)(void);
}soft_i2c_t;

void bsp_i2c_start(soft_i2c_t * i2c);
void bsp_i2c_stop(soft_i2c_t * i2c);
void bsp_i2c_ack(soft_i2c_t * i2c);
void bsp_i2c_nack(soft_i2c_t * i2c);
uint8_t bsp_i2c_wait_ack(soft_i2c_t *  i2c);

void bsp_i2c_write_byte(soft_i2c_t * i2c, uint8_t byte);
uint8_t bsp_i2c_read_byte(soft_i2c_t *i2c);

BOOL i2c_check_device(soft_i2c_t * i2c);

#endif
